package minidb.record; 

public class RID {
	private int pageNum;
	private int rid;
	
	public RID(int pageNum, int rid){
		this.pageNum = pageNum;
		this.rid = rid;
	}
	
	public RID(String ridStr){
		int pos = ridStr.indexOf(',');
		String str1 = ridStr.substring(0, pos);
		String str2 = ridStr.substring(pos+2);
		this.pageNum = (new Integer(str1)).intValue();
		this.rid = (new Integer(str2)).intValue();
	}
	
	public int rid(){ return this.rid; }
	
	public int pageNum(){ return this.pageNum; }
	
	public void rid(int rid){ this.rid = rid; }
	
	public void pageNum(int pageNum){ this.pageNum = pageNum; }
	
	public boolean equals(RID r) {	
		return this.pageNum == r.pageNum() && this.rid==r.rid();
	}
	
	public String toString() {
		return pageNum + ", " + rid;
	}
}
